package com.stylefeng.guns.modular.system.warpper;

import java.text.DecimalFormat;
import java.util.Date;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.DateUtil;

public class GdtjWarpper extends BaseControllerWarpper{

	public GdtjWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
    	Date gRdate = ((Date)map.get("gRdate"));
    	map.put("gRdate", DateUtil.format(gRdate, "yyyy-MM-dd"));
    	
    	String gBz = ((String)map.get("gBz"));
    	if(gBz.equals("减少")){
    		map.put("gBz", "<font color='green'><b>"+gBz+"</b></font>");
    	}else if(gBz.equals("新进") || gBz.equals("增加")){
    		map.put("gBz", "<font color='red'><b>"+gBz+"</b></font>");
    	}
    	DecimalFormat df = new DecimalFormat("0.00000");
    	
    	String gBdbl = (String)map.get("gBdbl");
    	if(StringUtils.isNotEmpty(gBdbl) && !StringUtils.endsWith(gBdbl, "-")){
    		map.put("gBdbl", df.format(Double.valueOf((String)map.get("gBdbl"))));
    	}
    }
}
